package nuc.jyg.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author Nuc YongGuang Ji
 * Created by JiYongGuang on 2017/5/17.
 */

/*
* 全局错误处理类(所有Controller类)
*
* */
@ControllerAdvice
public class ErrorController {
    @ExceptionHandler(value = RuntimeException.class)
    public ModelAndView testError(Exception e) {
        ModelAndView mv = new ModelAndView("error.jsp");
        mv.addObject("exception", e);
        System.out.println("Now in ErrorController");
        return mv;
    }
}
